"""
员工添加
员工修改
员工查询
员工删除
"""
#导包
import requests
#创建接口类
import app


class EmployeeAPI:
    #初始化
    def __init__(self):
        self.url_add_employee = app.BASE_URL + "/api/sys/user"
        self.url_put_employee = app.BASE_URL + "/api/sys/user/{}"
        self.url_get_employee = app.BASE_URL + "api/sys/user/{}"
        self.url_delete_employee = app.BASE_URL + "/api/sys/user/{}"

    def add_employee(self, add_employee_data):
        return requests.post(url=self.url_add_employee, json=add_employee_data, headers=app.header_data)

    def put_employee(self, employee_id, put_employee_data):
        return requests.put(url=self.url_put_employee.format(employee_id),json=put_employee_data,headers=app.header_data)

    def get_employee(self,employee_id):
        return requests.get(url=self.url_put_employee.format(employee_id), headers=app.header_data)

    def delete_employ(self, employee_id):
        return requests.delete(url=self.url_delete_employee.format(employee_id), headers=app.header_data)

# 封装接口